﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

public static class DebugExtension
{
    public static void DrawRect(this Rect Area,Color color)
    {
        Vector2 LeftTop = new Vector2(Area.xMax, Area.yMax);
        Vector2 RightTop = new Vector2(Area.xMin, Area.yMax);
        Vector2 RightBot = new Vector2(Area.xMin, Area.yMin);
        Vector2 LeftBot = new Vector2(Area.xMax, Area.yMin);

        UnityEngine.Debug.DrawLine(LeftTop, RightTop, color);
        UnityEngine.Debug.DrawLine(RightTop, RightBot, color);
        UnityEngine.Debug.DrawLine(RightBot, LeftBot, color);
        UnityEngine.Debug.DrawLine(LeftBot, LeftTop, color);
    }
    /// <summary>
    /// GL画摄像机矩形有些许问题
    /// </summary>
    /// <param name="Area"></param>
    public static void GLDrawRect(this Rect Area)
    {
        //GL.LoadPixelMatrix(); 
        GL.PushMatrix();
        GL.Begin(GL.LINES);
        GL.Color(new Color(1,0,0));
        GL.Vertex3(Area.xMin, Area.yMax, 1);
        GL.Vertex3(Area.xMax, Area.yMax, 1);
        GL.End();

        //GL.Begin(GL.LINES);
        //GL.Color(new Color(1, 0, 0));
        //GL.Vertex3(Area.xMin, Area.yMin, 1);
        //GL.Vertex3(Area.xMax, Area.yMax, 1);
        //GL.End();
        //GL.Vertex3(10, 10, 1);
        //GL.Vertex3(Area.xMin, Area.xMin, 1);
        //GL.Vertex3(Area.xMin, Area.yMax, 1);

        // GL.Vertex3(Area.xMax, Area.yMax, 1);
        // GL.Vertex3(Area.xMax, Area.yMin, 1);

        // GL.Vertex3(Area.xMax, Area.yMin, 1);
        //  GL.Vertex3(Area.xMax, Area.yMin, 1);

        //GL.Vertex3(Area.xMin, Area.yMin, 1);
        //GL.Vertex3(Area.xMax, Area.yMin, 1);
        GL.PopMatrix();
    }


}

